const prefix = '/hospital';
const suffix = '.do';

const urlMap = {
    'dev': {
        // 管理端
        '创建医院科室': '/createHospitalDepartment',
        '编辑医院科室': '/editHospitalDepartment',
        '编辑医院科室(多选)': '/editHospitalDepartments',
        '获取当前用户的权限路径': '/getCurrentUserPermissionPath',
        '医院职工类别集合和医院职称名称集合': '/getStaffTypeAndProTitleForOption',
        '医院职工类别集合': '/getStaffTypeForOption',
        '医院职称集合': '/getProTitleForOption',
        '医院科室列表': '/hospitalDepartmentList',
        '医院科室分配权限详情': '/hospitalDepartmentPermission',
        '医院科室类别列表': '/hospitalDepartmentTypeList',
        '保存医院科室分配权限': '/saveHospitalDepartmentPermission',
        'findTypeAndNameByDepartmentTypeId': '/rpc/findTypeAndNameByDepartmentTypeId',
        '医院人员维护列表': '/preHospitalUserList',
        '创建医院职工': '/createPreHospitalUser',
        '编辑医院职工': '/editPreHospitalUser',
        '选择科室': '/chooseDepartment',
        '退出登录': '/signout',
        
        // 医师端
        '已审核处方详情(医院药师)': '/auditedPrescription',
        '已审核处方列表(医院药师)': '/auditedPrescriptionList',
        '处方审核详情(医院药师)': '/auditingPrescription',
        '处方审核列表(医院药师)': '/auditingPrescriptionList',
        '创建电子处方(医师)': '/createPrescription',
        '审核处方(医院药师)': '/dealPrescription',
    }
};

export const urlService = (type: string, key: string) => {
    const url = urlMap[type][key];
    if (url) {
        return prefix + urlMap[type][key] + suffix;
    } else {
        throw Error(`fail to find url: ${key}`);
    }
};

